<?php
$form = $this->beginWidget('CActiveForm', array(
            'id' => 'ecom-products-form',
            'enableAjaxValidation' => false,
             'htmlOptions'=>array('enctype'=>'multipart/form-data'),
        ));
?>
<div class="block">
    <div class="alert alert_grey">
        <img height="24" width="24" src="<?php echo Yii::app()->params['backendUrl']; ?>/images/icons/small/grey/alert_2.png">
        Fields with <span class="required"><strong>*</strong></span> are required.
    </div>

    <?php echo $form->errorSummary($model); ?>

    <div class="input_group">
        <?php echo $form->labelEx($model, 'products_products_category_id'); ?>
        <?php echo $form->dropDownList($model, 'products_products_category_id', CHtml::listData(ecom_products_category::model()->findAll(), 'products_category_id', 'products_category_title'), array('prompt' => 'Please Select Category')); ?>
        <?php //echo $form->error($model, 'products_products_category_id');  ?>
    </div>

    <?php echo $form->labelEx($model, 'products_code'); ?>
    <?php echo $form->textField($model, 'products_code', array('size' => 20, 'maxlength' => 25)); ?>
    <?php //echo $form->error($model,'products_code'); ?>

    <?php echo $form->labelEx($model, 'products_name'); ?>
    <?php echo $form->textField($model, 'products_name', array('size' => 50, 'maxlength' => 100)); ?>
    <?php //echo $form->error($model,'products_name'); ?>

    <?php echo $form->labelEx($model, 'products_description'); ?>
    <?php echo $form->textArea($model, 'products_description', array('cols' => 50, 'rows' => 10)); ?>
    <?php //echo $form->error($model,'products_description');  ?>

    <?php echo $form->labelEx($model, 'products_price'); ?>
    <?php echo $form->textField($model, 'products_price', array('size' => 20, 'maxlength' => 20)); ?>
    <?php //echo $form->error($model,'products_price');  ?>

    <?php echo $form->labelEx($model, 'products_bv'); ?>
    <?php echo $form->textField($model, 'products_bv', array('size' => 20, 'maxlength' => 20)); ?>
    <?php //echo $form->error($model,'products_price');  ?>

    
    <?php echo $form->labelEx($model, 'products_sponsor_bonus_value'); ?><i>Khusus untuk product DRP</i>
    <?php echo $form->textField($model, 'products_sponsor_bonus_value', array('size' => 20, 'maxlength' => 20)); ?>
    <?php //echo $form->error($model,'products_sponsor_bonus_value');  ?>
    <h2>Field dibawah ini khusus untuk produk voucher</h2>
    <?php echo $form->labelEx($model, 'products_hpp'); ?>
    <?php echo $form->textField($model, 'products_hpp', array('size' => 20, 'maxlength' => 20)); ?>
    
    <?php echo $form->labelEx($model, 'products_profit_share'); ?> 
    <b>Persentase dari (HPP - Harga Jual) yang akan dibagi ke member. </b>
    <i><br/>contoh jika harga jual 1.000.000, hpp 500.000 <b><font color="red">profit sharing diset 60</font></b>, <br/>maka komisi yang akan dibagi ke member : <br/>(1.000.000-500.000) x 60% = 300.000</i><br/>
    <?php echo $form->textField($model, 'products_profit_share', array('size' => 20, 'maxlength' => 20)); ?>

    <div class="input_group">
        <?php echo $form->labelEx($model, 'products_images'); ?>
        <?php
        if(!$model->isNewRecord && $model->products_images != null) {
            echo '<div>'.CHtml::image(Yii::app()->params['config']['dir']['products'].$model->products_images, (($model->products_images != null) ? $model->products_name : ''), array('width' => 100)).'</div>';
        }
        ?>
        <?php echo CHtml::activeFileField($model, 'products_images'); ?>
        <?php //echo $form->error($model, 'news_image'); ?>
    </div>

    <button class="button_colour round_all"><img height="24" width="24" alt="Bended Arrow Right" src="<?php echo Yii::app()->params['backendUrl']; ?>/images/icons/small/white/bended_arrow_right.png"><span><?php echo ($model->isNewRecord) ? 'Create' : 'Save'; ?></span></button>

    <?php $this->endWidget(); ?>

</div>
<!-- form -->